Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Fixed the issue where the handwriting input method was unusable… #822

Closed
wants to merge 1 commit into from

Conversation

ChenTianSaber
Copy link

Fixed the issue where the handwriting input method was unusable on iOS and unable to delete on Android.

My users reported a bug in the handwriting input feature, and I've fixed it.

default.mp4

@LucasXu0
Copy link
Collaborator

  void _updateComposing(TextEditingDelta delta) {
    if (delta is TextEditingDeltaNonTextUpdate) {
      composingTextRange = delta.composing;
    } else {
      composingTextRange = composingTextRange != null &&
              composingTextRange!.start != -1 &&
              delta.composing.end != -1
          ? TextRange(
              start: composingTextRange!.start,
              end: delta.composing.end,
            )
          : delta.composing;
    }
  }

@ChenTianSaber I did some changes on the _updateComposing function. You may can refer to it.

@LucasXu0
Copy link
Collaborator

@ChenTianSaber By the way, what did you mean by the issue "unable to delete on Android."?

@ChenTianSaber
Copy link
Author

@ChenTianSaber By the way, what did you mean by the issue "unable to delete on Android."?

@LucasXu0
Please watch the following video. The steps to reproduce the issue are as follows:

20240619-130956.mp4
  1. Use the handwriting input method on Android.
  2. After inputting, keep the text in the composing state.
  3. At this point, clicking the delete button has no effect.

The reason for this issue is that when the text is in the composing state, enableShortcuts is set to false. As a result, clicking the delete button only triggers the onKeyEvent event, which gets ignored because enableShortcuts is false.

@ChenTianSaber
Copy link
Author

  void _updateComposing(TextEditingDelta delta) {
    if (delta is TextEditingDeltaNonTextUpdate) {
      composingTextRange = delta.composing;
    } else {
      composingTextRange = composingTextRange != null &&
              composingTextRange!.start != -1 &&
              delta.composing.end != -1
          ? TextRange(
              start: composingTextRange!.start,
              end: delta.composing.end,
            )
          : delta.composing;
    }
  }

@ChenTianSaber I did some changes on the _updateComposing function. You may can refer to it.

Thanks, I will try this code.

@LucasXu0
Copy link
Collaborator

@ChenTianSaber I also tested the deletion issue on Android. It seems working fine if using the code snippet I posted without changing the keyboard service.

@ChenTianSaber
Copy link
Author

@ChenTianSaber I also tested the deletion issue on Android. It seems working fine if using the code snippet I posted without changing the keyboard service.

image

@LucasXu0 I used your code and rolled back the keyboard_service_widget.dart code, but the issue still exists on Android.

Are you using the Android handwriting input method? The problem only occurs with the handwriting input method. As I mentioned above, when enableShortcuts = false and the delete key is pressed, it only triggers _onKeyEvent. At this point, the event is ignored.

@LucasXu0
Copy link
Collaborator

@ChenTianSaber I'll submit a new pull request to resolve the backspace issue in Android handwriting input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants